/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023.
 * Description: support msi irqdesc cleanup function
 * Author: huyizhou
 * Create: 2023-09-13
 */

static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node,
			      const struct cpumask *affinity, struct module *owner);

/**
 * dynamic_irq_cleanup - cleanup a dynamically allocated irq
 * @irq:        irq number to initialize
 */
void dynamic_irq_cleanup(unsigned int irq)
{
	struct irq_desc *desc = irq_to_desc(irq);
	unsigned long flags;
	if (!desc) {
		printk(KERN_ERR "[%s-%d] can't find dynamic irq desc\n",
		       __func__, __LINE__);
		return;
	}
	raw_spin_lock_irqsave(&desc->lock, flags);
	desc_set_defaults(irq, desc, irq_desc_get_node(desc), NULL, NULL);
	raw_spin_unlock_irqrestore(&desc->lock, flags);
}
EXPORT_SYMBOL_NS(dynamic_irq_cleanup, HW_RTOS_NS);
